MY NES
------
A Nintendo Entertainment System / Family Computer (Nes/Famicom) Emulator written in C#.

Copyright  Ala Ibrahim Hadid 2009 - 2017 
All rights reserved.

What's New ?
-------
Version 7.0.6516 
Built at 03, Nov, 2017 00:04.

. Emulation engine rebuild from scratch, the code is now optymized and faster than ever... along
  with more accuracy.
. My Nes now is one package that can run on all platforms that support SDL and mono. Thanks
  to SDL2 to make this happening.
. Fixed a lot of bugs related to emulation, check out the commits in the source code for more
  details.
. My Nes now include a simple GUI engine, that allows to access games and config almost all emu
  settings without the need of leaving the app, even in fullscreen mode. 

Introduction
--------------------------------------------------------------------------------------------------
My Nes is A Nintendo Entertainment System / Family Computer (Nes/Famicom) emulator written in C#. 
My Nes is meant to be simple, powerful and accurate Nes emulator.

My Nes is open source .net freeware, licensed under the GNU GENERAL PUBLIC LICENSE; 
Version 3, 29 June 2007.

My Nes can pass all basic nes tests that test nes hardware behaviors, such as cpu 6502 instructions, 
ppu timing .... etc. However, My Nes pass most of these tests (known at development time of current 
version) without any kind of HACKING (changing some code to make a test pass), by emulating the 
exact hardware behavior.
For example, My Nes can pass cpu interrupt tests (cpu_interrupts_v2 by Shay Green 
<gblargg@gmail.com>) by emulating cpu cycle timing and interrupts check at the next half of cpu 
cycle. Same for DMA behavior, 
Sprite 0 Hit, Sprite overflow flags, APU length counter and IRQ ....etc

My Nes also implements the NTSC/PAL video generator (palettes), enjoy the nes real colors !

If you are looking for a simple Nes emulator provides accuracy that very close to the real hardware, 
My Nes is a one worth a try !

System Requirements
--------------------------------------------------------------------------------------------------

- Hardware:
CPU: 2400 MHz or higher. Multicore CPU is recommended.
RAM: 512 MB or higher.

- For Windows Users:

.Works with Windows XP SP3, Vista, Seven, 8, 8.1 and 10; X86 or X64.
.Microsoft .NET Framework 4.5.
NOTE: My Nes set to run using opengl driver. If My Nes run showing empty white window, 
      close it then please to documents.
      Open file C:\Users\<user>\Documents\MyNes\sdlsettings.ini
      Change Video_Driver=opengl to Video_Driver=direct3d
      Save changes then try to run My Nes again.

- For Linux users:
. MyNes should work on all platforms that run mono. But you may need Mono runtime; 
  For more info and downloads please visit http://www.mono-project.com/GtkSharp
. SDL2, SDL2_ttf and SDL2_image. 

For example, installing SDL2 libraries on Ubuntu:
// For latest version, please check out https://packages.ubuntu.com/search?keywords=sdl2
// SDL2
sudo apt-get install libsdl2-2.0-0
sudo apt-get update
// SDL2_image
sudo apt-get install libsdl2-image-2.0-0
sudo apt-get update
// SDL2_ttf
sudo apt-get install libsdl2-ttf-2.0-0
sudo apt-get update


**IMPORTANT NOTE**
If MyNes run in linux but fails to run a game (some exception show in the terminal about 
BlipBuffer.so), try to copy the BlipBuffer.so file into /usr/lib/ folder
simply enter this command (assuming that the terminal working directory is on MyNesGTK folder):

// Copy the BlipBuffer.so file into /usr/lib/.
sudo cp BlipBuffer.so /usr/lib/
// Just in case, give BlipBuffer.so the permissions it need
sudo chmod 755 /usr/lib/BlipBuffer.so

Features And Specification
--------------------------------------------------------------------------------------------------
. My Nes is a multi-cross platform application, thanks to SDL2 and #SDL-CS for making this happen !
. My Nes Uses NesCart DB to show and use accurate game information.
. My Nes has an engine called "My Engine", which is a simple GUI engine that allows user to 
  configure everything in the same window. Also, a rom browser is included and built using that 
  engine.
. Run game in windowed or fullscreen mode with useful video options like keep aspect ratio.
. Ability to save snapshots of current game.
. Save and load state ability.
. Very fast, My Nes is tested in old machines, both in Windows and Linux and runs perfectly 60 fps.

- My Nes Core Features
. Accuracy, My Nes pass almost all known nes tests by emulating the real hardware behaviors 
  without any kind of emulation hack.
. Multithreaded Emulator, the emulation process run in thread separated from renderer threads. 
  This may improve performance especially with multi core cpus. 

- My Nes Emulation Specification
. CPU 6502: All CPU 6502 instructions implemented including the so called illegal opcodes.
. Interrupts: Implement exact interrupt timings like interrupt check before the last instruction 
  behavior
. PPU: Implement the Picture Processor Unit as described in the wiki docs 
  http://wiki.nesdev.com/w/index.php/PPU_rendering with exact timing
. Palettes: Implement the palette generator of NTSC video as described at 
  http://wiki.nesdev.com/w/index.php/NTSC_video
. TV Formats: NTSC, PALB and DENDY.
. Sound: Implement all Nes 5 sound channels, MMC5 external sound channels and VRC6 external 
  sound channels. Also the DC Blocker filter is applied to the output.
. Sound Playback: Frequency can be 22050 Hz, 44100 Hz or 48000 HZ. Bit rate fixed to 16 bit, 
  channels fixed to Mono. 
. Mappers And Boards: Implement about 97% of known and documented mappers
. Controllers: 2 players joypads, each joypad is playable through Keyboard, 
  Joystick or XBox360 Game Controller (XInput). 

How To Use
--------------------------------------------------------------------------------------------------
My Nes is a command-line application, you can use it along with an external launcher such as
Emulators Organiser <http://sourceforge.net/projects/emusorganizer/>
My Nes include simple GUI that allows to launch games and configure settings.

- My Nes GUI:

-- Main Window:
--------------
When you run My Nes, it shows the main menu in the top. 
NOTE that the main menu can be shown any time during game play using F1 key.
F1: show the main menu but never pause the emulation. This can be usefull to confugre stuff 
    during game play such as palette.
F2: pause emulation and show the main menu. This is usefull to change game, save state, load state, 
    take snap ...etc

] Menus:
. File:
    > Open: Allow to browse for a rom to start playing. NOTE that currently only .nes files are 
      supported, archive support is coming soon.
    > Save State: Save current game state at state slot specified in State Slot.
    > Load State: Load current game state from state slot specified in State Slot.
    > State Slot: The state slot to use for state load and save.
    > Save State As: Save current game state at state slot that can be selected in the window 
      that appear.
    > Load State As: Load current game state from state that can be selected in the window
      that appear.
    > Rom Info: Show current loaded game info.
    > Exit: Exit My Nes.
. Machine:
    > Turbo: When game is running, toggle turbo speed (turn fps limiter on/off) so that some stuff 
      in games can be skipped.
    > Emulation ON: When game is running, this will turn off emulation for current game and return 
      to the Standby mode (snow effect of CRT tv in channel 3). 
    > Emulation PAUSED: When game is running, toggle emulation pause.
    > Hard Reset: When game is running, hard reset the emulation. Note this will load the game 
      as if the nes is turned off then on.
    > Soft Reset: When game is running, soft reset the emulation. Note this is as the reset key 
      is pressed in the real console.
    > Region (will hard reset): select the region setting. Can be:
      Auto Select: auto select the region depening on rom loaded.
      Force NTSC: always use the NTSC region regadless of the rom origin.
      Force PALB: always use the PALB region regadless of the rom origin.
      Force DENDY: always use the DENDY region regadless of the rom origin.
      NOTE that PALB and DENDY are not emulated propably in the BETA version. 
      Recommended choice is to leave it Auto Select.
. Video:
    > Take Snapshot: take a snapshot of current screen (only emu screen, gui elements are not 
      included).
    > Show FPS: toggle if FPS text should be visible or not.
    > Fullscreen: toggle fullscreen (set means fullscreen, not set means windowed)
    > Keep aspect ratio: toggle if the aspect ratio should be used when rendering pixels.
    > Palettes: cofigure palettes settings. See the Palettes section for more details.
    > More ...: cofigure video advanced settings. See the Video Settings section for more details.
. Audio:
    > Sound Enabled: toggle if sound playback is enabled or not.
    > Freuqnecy (requires restart): select the audio playback frequency. This setting requires
      My Nes to restart.
    > Sound Channels: select the sound channels that should be enabled/disabled during audio 
      playback.
. Input:
    > Player 1 Input: open the player 1 input configuration window. For more details, 
      please see the Player 1 Input section.
    > Player 2 Input: open the player 2 input configuration window. For more details, 
      please see the Player 2 Input section.
    > Player 3 Input: open the player 3 input configuration window. For more details, 
      please see the Player 3 Input section.
    > Player 4 Input: open the player 4 input configuration window. For more details, 
      please see the Player 4 Input section.
    > 4 Players Connected: enables or disables 4 players. Player 3 and 4 only activated when this
      option is set.
. Help: Include some menu items that allows to show help document, visit My Nes website and 
        facebook page and the about box.

-- Video Settings:
------------------
Allows to configure emulation and gui video settings directly. Some reuires My Nes to restart to 
take effect.

To show the video settings dialog, simply go to Video>More ... from the main menu.
The main menu can be shown any time during game play using F1 key.

. Video driver: select the driver to use for video (SDL 2 window). 
  Most common are opengl and direct3d. My Nes set to opengl by default. If problems occured in
  windows, this should be changed to direct3d.
  See System Requirements Section above.
. Show FPS: toggle if the fps text should be visible or not.
. FPS high contrast: if set, fps text will be displayed with background. Otherwise the fps 
  text will be displayed without background.
. FPS location: specify the location of the fps text if visible.
. Keep aspect ration: toggle if the aspect ratio of nes resolution should remain, otherwise the 
  renderer will stretch the image to fit the screen (window size or fullscreen resolution).
. hide lines .... : In real Nes hardware, there is some scanlines hidden (not all 256 x 240 pixels 
  are visible). This option indicates if the 
  renderer show hide these lines or not (8 in NTSC and 1 in PAL from top and bottom).
. Auto stretch window when starting a game (windowed mode only): If set, the emulation window will 
  auto resize itself to fit the resizing value giving.
. Stretch Multiply: If "Auto resize window to fit emulation size" is set, this value will be used 
  to determine the window size by multiply 
  this value with 256 as width and 240 as height. 
  Examples:
  N=2 then window size is 512 x 480
  N=3 then window size is 768 x 720
  .....
. Fullscreen with this mode: toggle if My Nes should run in fullscreen or windowed mode. You can 
  switch between windowed and fullsceen modes any time using F12 key.
  Mode can be selected next to this option.
. Enable VSync: toggle if vertical synchronisation should be enabled or not. Recommended is to
  leave it as it is (enabled)
. Enable Acceleration: toggle if video acceleration should be used or not. Recommened is to leave 
  it as it is (disabled) since this may cause problems in some macheins.
. Enable Software rendering: toggle if software rendering should be enabled or not. Recommended is 
  to leave it as it is (enabled)

Click Defaults button to reset all settings to it's defaults.
Click Save and apply button to save settings and apply the settings that can be applied without 
restarting My Nes. 
Click Close discarding changes button to discard changes.

-- Palette Settings:
--------------------
Allows to configure emulation palette or colors settings.
These palettes are used by nes emulation core to output colors. My Nes include 2 palette generators, 
NTSC palette generator and PALB palette generator. The NTSC palette generator is implemented as 
described at http://wiki.nesdev.com/w/index.php/NTSC_video
There is no information provided about the PALB palette generator (as the date of this document). 
My Nes implements it as same as the NTSC palette generator with simple change: hue is rotated by 
15 from NTSC for default.

My Nes implement the "emphasis" and "monochrome" effect, thus, the palette generated is 512 colors 
instead of known 64 colors palettes. 
The generators in My Nes able to generate the 512 colors palette. Also My Nes can generate the 
palette files of 64 colors.

To show the palette settings dialog, simply go to Video>Palette from the main menu.
The main menu can be shown any time during game play using F1 key.

NOTE that palette generator configuration applied directly during game play (if game is not paused) 
so that you can take a look at the changes during game play. The palette settings will load again 
once this dialog is closed.

. Palette Mode: configure how's the emulation core chooses a palette when running a game. 
* AUTO: the emulation core selects a palette generator depending on rom region settings (loaded from
  game file header or from NesCartDB), 
  like selecting the NTSC palette generator for NTSC tv format and PALB palette generator for PALB 
  or DENDY tv format.
* Force NTSC: the emulation core will always use the NTSC palette generator.
* Force PALB: the emulation core will always use the PALB palette generator.
* File: use palette file selected in the list bellow this option.
. Configure palette generator of: select the palette generator you want to edit settings for here, 
  NTSC palette generator or PALB palette generator.
  HAS NO EFFECT on palette mode selection. Just to confugre the generator(s).
. Palette file: select the palette file to use if the Palette Mode is set to FILE. The files listed 
  are located at Palettes folder in My Nes folder.
  You can put the palette file you like to use there. (files of .pal extensions, both 64 and 512 
  indeacs palettes are supported)

Click Save and apply button to save and apply the settings. 
Click Close discarding changes button to discard changes.

-- Player 1 Input:
-----------------
Allows to configure player 1 input.

To show the Player 1 Input settings dialog, simply go to Input>Player 1 Input from the 
main menu.
The main menu can be shown any time during game play using F1 key.

Select the page you want to change the input mapping for.
. Input Method: change the input method to use for player 1. Can be Keyboard, Joystick or Xinput.
  Note that the emu will switch back to Keyboard if selected input method is not connected.
. Joystick Index: select the joystick index to use if the Input Method is Joystick.
. XInput Index: select the XInput controller index to use if the Input Method is Xinput.
. Buttons mapping: Simply click on the button to change using selected input method.
. Set all: click this button to map all buttons.

Click Save and apply button to save and apply the settings. 
Click Close discarding changes button to discard changes.

-- Player 2 Input:
-----------------
Allows to configure player 2 input.

To show the Player 2 Input settings dialog, simply go to Input>Player 2 Input from the 
main menu.
The main menu can be shown any time during game play using F1 key.

Select the page you want to change the input mapping for.
. Input Method: change the input method to use for player 2. Can be Keyboard, Joystick or Xinput.
  Note that the emu will switch back to Keyboard if selected input method is not connected.
. Joystick Index: select the joystick index to use if the Input Method is Joystick.
. XInput Index: select the XInput controller index to use if the Input Method is Xinput.
. Buttons mapping: Simply click on the button to change using selected input method.
. Set all: click this button to map all buttons.

Click Save and apply button to save and apply the settings. 
Click Close discarding changes button to discard changes.

-- Player 3 Input:
-----------------
Allows to configure player 3 input.

To show the Player 3 Input settings dialog, simply go to Input>Player 3 Input from the 
main menu.
The main menu can be shown any time during game play using F1 key.

Select the page you want to change the input mapping for.
. Input Method: change the input method to use for player 3. Can be Keyboard, Joystick or Xinput.
  Note that the emu will switch back to Keyboard if selected input method is not connected.
. Joystick Index: select the joystick index to use if the Input Method is Joystick.
. XInput Index: select the XInput controller index to use if the Input Method is Xinput.
. Buttons mapping: Simply click on the button to change using selected input method.
. Set all: click this button to map all buttons.

Click Save and apply button to save and apply the settings. 
Click Close discarding changes button to discard changes.

-- Player 4 Input:
-----------------
Allows to configure player 4 input.

To show the Player 4 Input settings dialog, simply go to Input>Player 4 Input from the 
main menu.
The main menu can be shown any time during game play using F1 key.

Select the page you want to change the input mapping for.
. Input Method: change the input method to use for player 4. Can be Keyboard, Joystick or Xinput.
  Note that the emu will switch back to Keyboard if selected input method is not connected.
. Joystick Index: select the joystick index to use if the Input Method is Joystick.
. XInput Index: select the XInput controller index to use if the Input Method is Xinput.
. Buttons mapping: Simply click on the button to change using selected input method.
. Set all: click this button to map all buttons.

Click Save and apply button to save and apply the settings. 
Click Close discarding changes button to discard changes.

-- Command-lines:
-----------------
My Nes is a command-line based application, and thus, you need to use command-lines to use it.

The most important command is the first one, the game file path. The game file path MUST be the 
first command to be sent to My Nes in order to play that game. 
If you like to use command-line without launching a game, My Nes will execute these commands then 
go to the Standby mode. 
If you send the game path anywhere else in the command-lines then My Nes will discard this path 
line, execute the other commands then go to the Standby mode.

Example of a working command-line:

<game-file-path> -fullscreen -console -state.slot2 -state.load

This command-line will first set to fullscreen mode, show console, load the game file at 
<game-file-path>, set state slot to # 2 then load the state.

Note that you should keep one space between each command.

-- List of available command-lines:
----------------------------------
-console: show My Nes console. Note that the console in this version is only can be used to 
show what's going on.
-opengl: set video driver to opengl.
-direct3d: set video driver to direct3d. Use this if you have problems running My nes in 
Windows such as empty widnow.
-opengles2: set video driver to opengles2.
-opengles: set video driver to opengles.
-software: set video driver to software.
-fullscreen: set fullscreen mode.
-windowed: set windowed mode.
-fps: show fps.
-vsync: enable vsync.
-accelerated: enable acceleration.
-soundon: enable sound playback.
-player1.key: force player 1 to use Keyboard.
-player1.joy: force player 1 to use Joytick. (If connected, otherwise Keyboard will be used.)
-player1.xin: force player 1 to use Xinput (If connected, otherwise Keyboard will be used.)
-player2.key: force player 2 to use Keyboard.
-player2.joy: force player 2 to use Joytick. (If connected, otherwise Keyboard will be used.)
-player2.xin: force player 2 to use Xinput (If connected, otherwise Keyboard will be used.)
-region.auto: set region settings to auto select.
-region.ntsc: set region settings to force NTSC.
-region.pal: set region settings to force PALB.
-region.dendy: set region settings to force DENDY.
-palette.auto: set palette settings to auto select.
-palette.ntsc: set palette settings to force NTSC palette generator.
-palette.pal: set palette settings to force PALB palette generator.
-palette.file: set palette settings to use palette file.
-settings: activate settings-only mode. In this mode, My Nes will only load settings, then
executes the commands that set settings then close. No window nor emu will run.

These commands are only used after loading a game, thus, the game path command should be 
presented in order these commands to work.
-state.load: load state at slot specified.
-state.slot0: set state slot to # 0
-state.slot1: set state slot to # 1
-state.slot2: set state slot to # 2
-state.slot3: set state slot to # 3
-state.slot4: set state slot to # 4
-state.slot5: set state slot to # 5
-state.slot6: set state slot to # 6
-state.slot7: set state slot to # 7
-state.slot8: set state slot to # 8
-state.slot9: set state slot to # 9


Copyright Notice
--------------------------------------------------------------------------------------------------
Please read the file "Copyright Notice.txt" or see the about box in MyNes for more details.

Support
--------------------------------------------------------------------------------------------------
Website: http://sourceforge.net/projects/mynes/

Article about My Nes in CodeProject: http://www.codeproject.com/KB/game/MyNes_NitendoEmulator.aspx

Facebook page: http://www.facebook.com/pages/My-Nes/427707727244076